routine |
Documentation for routine |
assembled from the following types:
language documentation Operators
From Operators
(Operators) prefix |
Flattens objects of type Capture, Pair, List, Map and Hash into an argument list.
sub slurpee( |args ){ say args.raku }; slurpee( <a b c d>, { e => 3 }, 'e' => 'f' => 33 ) # OUTPUT: «\(("a", "b", "c", "d"), {:e(3)}, :e(:f(33)))»
Please see the Signature
page, specially the section on Captures for more information on the subject.
Outside of argument lists, it returns a Slip, which makes it flatten into the outer list. Inside argument list Positional
s are turned into positional arguments and Associative
s are turned into named arguments.
language documentation Operators
From Operators
(Operators) infix |
multi sub infix:<|>($a, $b --> Junction:D) is assoc<list>
Creates an any Junction from its arguments.
my $three-letters = /<[a b c]>/ | /<[i j k]>/ | /<[x y z]>/; say $three-letters.raku; # OUTPUT: «any(/<[a b c]>/, /<[i j k]>/, /<[x y z]>/)» say 'b' ~~ $three-letters; # OUTPUT: «True»
This first creates an any
Junction
of three regular expressions (every one of them matching any of 3 letters), and then uses smartmatching to check whether the letter b
matches any of them, resulting in a positive match. See also Junction for more details.